package com.aaa.controller;



import com.aaa.entity.result.Result;
import com.aaa.service.ContractLeaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.NotBlank;

/**
 * @author ：陈凯歌
 * @date ：Created in 2021/1/19 14:10
 * @description：租金业务管理器
 * @modified By：
 * @version: 1.0
 */
@RestController
@RequestMapping("/contract")
public class ContractLeaseController {

    /**
     * 注入service
     */
    @Autowired
    private ContractLeaseService service;

    /**
     * 查询所有应交租金信息
     * @return
     */
    @GetMapping("/list")
    public Result listAll(){

        Result rnt = service.getRnt();
        return rnt;
    }

    /**
     * 根据应收租金id查询详细操作
     * @param id
     * @return
     */
    @PostMapping("/get")
    public Result getId( @NotBlank(message = "需要传递token") @Validated Integer id){

        return service.getOperation(id);

    }
}
